﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace élénkPróbája.results
{
#if !SILVERLIGHT && !PORTABLE && !PORTABLE40 && !CoreCLR
    [Serializable]
#endif
    public class ValidationResult
    {

        private readonly List<ValidationFailure> errors = new List<ValidationFailure>();

        public virtual bool IsValid => Errors.Count == 0;

        public IList<ValidationFailure> Errors => errors;

        public ValidationResult()
        {
        }

        public ValidationResult(IEnumerable<ValidationFailure> failures)
        {
            errors.AddRange(failures.Where(failure => failure != null));
        }
    }
}